#pragma once
#include "LoadVolume.h"
#include "Transform.h"
#include "AABB.h"

//TODO: When brick size is less than 16 (i.e. 8, 4), there is still some bugs when some part won't show.
#define BRICKSIZE 8
#define EMPTY_THRESHOLD 0.0

namespace hiveDVR
{
	class COccupancyBrick
	{
	public:
		COccupancyBrick() = default;
		~COccupancyBrick() = default;

		void init(const std::shared_ptr<CVolume> vpVolume);
		size_t getSize() const { return m_TransformSet.size(); }
		glm::vec3 getNormalizedBoxSize() const;

		CTransform* getPtrOfTransformSet() { return m_TransformSet.data(); }

	private:
		std::vector<CAABB> m_OccupiedBoxSet;
		std::vector<CTransform> m_TransformSet;
		glm::vec3 m_NumBricks;

		void __generateOccupiedBoxSet(const std::shared_ptr<CVolume> vpVolume);
		void __generateInstanceMatrices();
		size_t __calculateNumberBrick(size_t vVolumeDimension) const;
	};
}